package shujujiegou;

import org.junit.Test;




public class SkipList<T> {
	
	public Node head;
	public Node last;//��һ���last�ڵ�
	
	
	public SkipList(int maxHeight) {
		//��һ��
		Node first = new Node();
		Node last = new Node();
		first.right = last;
		last.left = first;
		head = first;
		this.last = last;
		//����Ĳ�
		for(int i = 1; i < maxHeight; i++) {
			first = new Node();
			last = new Node();
			//����ڵ�����
			first.down = head;
			last.down = head.right;
			first.right = last;
			last.left = first;
			//ǰһ��ڵ�����
			head.upper = first;
			head.right.upper = last;
			//headָ�򱾲�first
			head = first;//ͷָ��ָ���һ��
		}
		
	}	
	
	
	public void add(int index, T t) {
		//LinkedList<String> linkedList = new LinkedList<String>();
		
		
		
	}
	//Ĭ����ӵ�lastǰ
	public void add(T t) {
		Node node = new Node();
		node.item = t;
		
//		node.key = (last.left.key!=null?last.left.key:-1) + 1 ;
		
	}
	
	
	public Node getNode(int index) {
		return null;
	}
	public T get(int index) {
		
		return null;
	}
	public void delete(int index) {
		
	}
	
}
class Node<T> {
	public Node<T> upper;
	public Node<T> down;
	public Node<T> left;
	public Node<T> right;
	public T item;
	
	public Node() {
		
	}
	
	public Node(Node<T> upper, Node<T> down, Node<T> left, Node<T> right,T item) {
		this.upper = upper;
		this.down = down;
		this.left = left;
		this.right = right;
		this.item = item;
	}
	
//	public Node<T> upper() {
//		return upper;
//	}
//	public Node<T> down() {
//		return down;
//	}
//	public Node<T> left() {
//		return left;
//	}
//	public Node<T> right() {
//		return right;
//	}
//	public T getValue() {
//		return item;
//	}
	
	
	
}